<?php

namespace app\chats\controller;

use think\Controller;
use think\Db;
use think\Session;

class Common extends Controller
{
    // 公共
    public function _initialize()
    {
        if (!Session::has('admin', 'mmjtChats')) {
            $this->redirect("Login/index");
        } else {
            $adminId = Session::get('admin', 'mmjtChats');
            $adminId = $admin = Db::name('user')->where(['phone' => $adminId['phone'], 'password' => $adminId['password']])->find();
            if (!$adminId) {
                session(null, 'mmjtChats');
                $this->redirect("Login/index");
            }
        }
    }
}
